setTimeout(function () {
  console.log('first setTimout');
}, 0);
console.log('my script start');
new Promise(function (resolve, reject) {
  console.log('my promise');

  resolve();
})
  .then(function () {
    console.log('promise.then');
  });
console.log('second script');
setTimeout(function () {
  console.log('second setTimeout');
  new Promise(function (resolve, reject) {
    console.log('promise in setTimeout');
    resolve(1);
    reject(2); // 无效代码
  })
    .then(function (res) {
      console.log('promise.then2', res);
    })
    .catch(function (err) {
      console.log('promise error', err);
    });
  console.log('script in setTimeout');
});
console.log('script end');